package com.plian.system.controller.pm.property;

import com.plian.Tools.base.BaseController;
import com.plian.Tools.pagedata.PageData;
import com.plian.system.model.CommonCode;
import com.plian.system.model.ListResult;
import com.plian.system.model.ObjResult;
import com.plian.system.service.pm.property.PropertyRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "api/propertyResult")
public class PropertyRecordController extends BaseController {
    @Autowired
    PropertyRecordService propertyRecordService;
    @PostMapping(value = "/listPage")
    public ListResult listPage(@RequestBody PageData pd) throws Exception {
        return propertyRecordService.listPage(pd);
    }
    @PostMapping(value = "/findByid")
    public ObjResult findByid(@RequestBody PageData pd) throws Exception {
        return propertyRecordService.findByid(pd);
    }
    @PostMapping(value = "/newFindByid")
    public ObjResult newFindByid(@RequestBody PageData pd) throws Exception {
        return propertyRecordService.newFindByid(pd);
    }
    @PostMapping(value = "/isRepeat")
    public ObjResult isRepeat(@RequestBody PageData pd) throws Exception {
        return propertyRecordService.isRepeat(pd);
    }
    @PostMapping(value = "/chlidList")
    public ObjResult chlidList(@RequestBody PageData pd) throws Exception {
        return propertyRecordService.chlidList(pd);
    }
    @PostMapping(value = "/tree")
    public ObjResult tree(@RequestBody PageData pd) throws Exception {
        return propertyRecordService.tree(pd);
    }
    @PostMapping(value = "/treeList")
    public ListResult treeList(@RequestBody PageData pd) throws Exception {
        return propertyRecordService.treeList(pd);
    }
    @PostMapping(value = "/TreeTotal")
    public ListResult treeTotal(@RequestBody PageData pd) throws Exception {
        return propertyRecordService.treeTotal(pd);
    }

    @PostMapping(value = "/treeExport")
    public ObjResult treeExport(@RequestBody PageData pd){
        PageData pageData = new PageData();
        pageData.put("key",  propertyRecordService.treeExport(pd));
        ObjResult objResult = new ObjResult(CommonCode.SUCCESS);
        objResult.setPageData(pageData);
        return objResult;
    }

    @PostMapping(value = "/listAll")
    public ObjResult listAll(){
        return propertyRecordService.listAll();
    }

}
